<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@page import="com.grep.web.IndexService,java.util.*"%>
<%@ include file="/./common/taglibs.jsp"%>
<%@ include file="../common/ckeckuser.jsp" %>
<%
	request.setCharacterEncoding("UTF-8");
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/"; 
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>首页</title>
		<link href="${base }/style/style.css" type="text/css" rel="stylesheet" />
		<script language="text/sjavascript" src="jquery-1.7.2.js"></script>
		
		<script type="text/javascript">
			function submitMethod()
			{
				var tableData = GetTableData(document.getElementById('tabProduct'))
				var x = JSON.stringify(tableData)
				var v1 = x.replace(/&lt;/g,"<");
				var v2 = v1.replace(/&gt;/g,">");
				document.getElementById("testcontents").value ="{\"targets\":"+v2+"}"
				//alert(document.getElementById("testcontents").value);
				document.form1.submit();
			}
			
		</script>
	</head>
	<body>
		<%@ include file="/./common/header.jsp"%>
	    <%@ include file="../common/tool_menu.jsp" %>  

		 
			 
		<div id="sider_right">
			<img src="${base }/images/rightbordertop.jpg" class="imgfloat" />

			<div id="sr_cont" class="siderborder">
				
				<form id="form1" name="form1" method="post" action="testgrep">

					<input type="button" name="Submit" value="新增"
						onclick="AddRow(document.getElementById('tabProduct'),1)" />
					<input type="button" name="Submit2" value="删除"
						onclick="DeleteRow(document.getElementById('tabProduct'),1)" />
					<input type="button" name="Submit22" value="重置"
						onclick="window.location.reload()" />


					<table width="640" border="0" cellpadding="0" cellspacing="0"
						id="tabProduct">
						<tr>
							<td width="32" align="center" bgcolor="#EFEFEF" Name="Num">
								<input type="checkbox" name="checkbox" value="checkbox" />
							</td>

							<td width="103" bgcolor="#EFEFEF" Name="targetname"
								EditType="TextBox">
								指标名称
							</td>
							<td width="103" bgcolor="#EFEFEF" Name="targetbegin"
								EditType="TextBox">
								指标开始符号
							</td>
							<td width="120" bgcolor="#EFEFEF" Name="targetend"
								EditType="TextBox">
								指标结束符号
							</td>
						</tr>
						
						<c:forEach var="target" items="${targetMap}"> 
							<tr>
								<td align="center" bgcolor="#FFFFFF"><input type="checkbox" name="checkbox2" value="checkbox" /></td>
								<td bgcolor="#FFFFFF"><c:out value="${target.targetName}" /></td>
								<td bgcolor="#FFFFFF"><c:out value="${target.beginRegex}" /></td>
								<td bgcolor="#FFFFFF"><c:out value="${target.endRegex}" /></td>
							</tr> 
						</c:forEach>
					</table>
					<br />
					测试地址：
					<input type="text" name="testurl" id="testurl" value="${testurl}" style="width:500;overflow-x:visible;"/>
					<input type="hidden" name="testcontents" id="testcontents"/>
					<input type="button" name="Submit3" value="采集测试"
						onclick="submitMethod()" />
				</form>
				
				测试结果：<br />
				<c:forEach var="ok" items="${grepresult}">  
					<c:out value="${ok.key}" />==>
   					<c:out value="${ok.value}" /><br />  
				</c:forEach>
				
				<script language="javascript" src="GridEdit.js"></script>
				<script language="javascript">
					var tabProduct = document.getElementById("tabProduct");
					
					// 设置表格可编辑
					// 可一次设置多个，例如：EditTables(tb1,tb2,tb2,......)
					EditTables(tabProduct);
				</script>
			</div>
			<img src="${base }/images/rightborderbuttom.jpg" class="imgfloat" />
		</div>
	</body>
</html>